﻿using System;
using System.Collections.Generic;
using System.Text;
using Galaxy.Core;
using System.Threading;

namespace Galaxy.ModuleInspector
{
    public sealed class Program
    {
        private static IGalaxyCore sf_Core;
        private static CGalaxyModuleInspector sf_Inspector;

        private static AutoResetEvent sf_Switch = new AutoResetEvent(false);

        [STAThread]
        public static void Main(string[] args)
        {
            sf_Switch.Reset();
            sf_Core = new CGalaxyCore();
            sf_Core.OnEnable += new Galaxy.Core.Events.OnEnableEventHandler(OnCoreEnable);

            sf_Core.Start();

            sf_Inspector = new CGalaxyModuleInspector();

            sf_Core.AddModule(sf_Inspector);

            sf_Switch.WaitOne();
        }

        private static void OnCoreEnable(CGalaxyCore Core, Galaxy.Core.Events.OnEnableEventArgs Arg)
        {
            if(!Arg.Enable) sf_Switch.Set();
        }
    }
}
